package com.amigo.online.consumer.video.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.amigo.online.common.core.response.Response;
import com.amigo.online.common.param.dto.pay.PayPromoteDto;
import com.amigo.online.consumer.video.service.PromoteService;

@RestController
@RequestMapping(value = "/promote", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class PromoteController{
	@Autowired
	PromoteService promoteService;
	
	/**
	 * 根据金额获取视频预计播放量
	 * @param money
	 * @return
	 */
	@GetMapping("/getExpectedViewAmount/{money}/{type}")
	public ResponseEntity<Response> getExpectedViewAmount(@PathVariable Integer money, @PathVariable Integer type){
		return promoteService.getExpectedViewAmount(money,type);
	}
	
	/**
	 * 我的速推管理页面
	 * @param money
	 * @return
	 */
	@GetMapping("/getMyPromoteInfo/{page}/{size}")
	public ResponseEntity<Response> getMyPromoteInfo(@PathVariable Integer page,@PathVariable Integer size){
		return promoteService.getMyPromoteInfo(page,size);
	}
	/**
	 * 速推订单详情
	 * @param money
	 * @return
	 */
	@GetMapping("/getPromoteOrderDetail/{promoteOrderId}")
	public ResponseEntity<Response> getPromoteOrderDetail(@PathVariable Long promoteOrderId){
		return promoteService.getPromoteOrderDetail(promoteOrderId);
	}
	
	/**
	 * 把一个推荐视频变成速推视频
	 * @param money
	 * @return
	 */
	@PostMapping("/addPromote")
	public ResponseEntity<Response> addPromote(@RequestBody PayPromoteDto dto){
		return promoteService.addPromote(dto);
	}
}
